/**
 * 版权所有@北京博创联动科技有限公司。未经许可，不得擅自复制、传播
 */
package com.uptech.homer.beans.body;

import com.uptech.homer.beans.AlarmInfo;
import com.uptech.homer.beans.CanBodyAdapter;
import com.uptech.homer.beans.annotation.AlarmField;
import com.uptech.homer.beans.annotation.CANField;
import com.uptech.homer.itf.IAccumulatedMileage;
import com.uptech.homer.itf.IBatteryPackData;
import com.uptech.homer.itf.IDriveMotorData;
import com.uptech.homer.itf.IIgnitionOffTime;
import com.uptech.homer.itf.IVehicleStatus;
import com.uptech.homer.util.ByteUtils;

import java.text.DecimalFormat;

/**
 * 小康EC35车身CAN协议
 *
 * @author lei lwen
 */
public class RptXKEc35Can extends CanBodyAdapter implements IIgnitionOffTime, IAccumulatedMileage, IDriveMotorData, IVehicleStatus, IBatteryPackData {
    public static final int _typeCode = 0x001F;
    private static final long serialVersionUID = 1L;
    private static final DecimalFormat decimalFormatter = new DecimalFormat("0.000");
    private static final DecimalFormat decimalFormatters = new DecimalFormat("0.00");
    private static final DecimalFormat decimalFormatterss = new DecimalFormat("0.0");

    /******0x0CFF7902********/

    /**
     * 电机实际转矩
     *
     * @return
     */
    @CANField(group = "MCU", name = "电机实际转矩", suffix = "Nm")
    public String get_MotorTorque() {
        if (ByteUtils.getUnsignedInt(data, 6, 8) > 0) {

            return decimalFormatters.format(ByteUtils.getUnsignedInt(data, 6, 8) * 0.25 - 5000);
        } else {

            return "" + 0;
        }

    }

    /**
     * 电机实际转速
     *
     * @return
     */
    @CANField(group = "MCU", name = "电机实际转速", suffix = "rpm")
    public int getMotorRpm() {
        if (ByteUtils.getUnsignedInt(data, 8, 10) > 0) {

            return (int) (ByteUtils.getUnsignedInt(data, 8, 10) - 12000);
        } else {

            return 0;
        }

    }

    /******0x0CFF7B02*******/

    /**
     * 电机温度
     *
     * @return
     */
    @CANField(group = "MCU", name = "电机温度", suffix = "℃")
    public double getMotorTemp() {
        if (ByteUtils.getUnsignedInt(data, 18, 19) > 0) {

            return ByteUtils.getUnsignedInt(data, 18, 19) - 40;
        } else {

            return 0;
        }

    }

    /**
     * 控制器温度
     *
     * @return
     */
    @CANField(group = "MCU", name = "控制器温度", suffix = "℃")
    public int getControlTemp() {
        if (ByteUtils.getInt(data, 17, 18) > 0) {

            return ByteUtils.getInt(data, 17, 18) - 40;
        } else {

            return 0;
        }

    }

    /*****0x0CFF7C02*******/

    /**
     * 电机超速故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorOverSpeedFault() {
        int level = ByteUtils.getInt(data, 20, 21) & 0x03;

        String str = "";
        String code = null;

        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机超速故障", str, level, code);
    }

    /**
     * 电机堵转故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorStallFault() {
        int level = (ByteUtils.getInt(data, 20, 21) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机堵转故障", str, level, code);
    }

    /**
     * 电机超温故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorOverTempFault() {
        int level = (ByteUtils.getInt(data, 20, 21) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3500301";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3500402";
                break;
            case 3:
                str += "三级故障";
                code = "E0000EC3500503";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机超温故障", str, level, code);
    }

    /**
     * 电机过流故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorOverCurrFault() {
        int level = (ByteUtils.getInt(data, 20, 21) & 0xC0) >> 6;

        String str = "";
        String code = "";
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3500702";
                break;
            case 3:
                str += "四级故障";
                level = 4;
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机过流故障", str, level, code);
    }

    /**
     * 电机电缆短路故障
     *
     * @return
     *//*
    @AlarmField(group = "MCU")
	public AlarmInfo getMotorCableShortFault() {
		int level = ByteUtils.getInt(data, 21, 22) & 0x07;

		String str = "";
		switch (level) {
		case 0:
			str += "正常";
			break;
		case 3:
			str += "三级故障";
			break;
		case 4:
			str += "四级故障";
			break;
		default:
			str += "数据异常"; level = -1; break;
		}
		return new AlarmInfo("电机电缆短路故障", str, level);
	}

	*//**
     * 电机交流侧对地短路
     *
     * @return
     *//*
    @AlarmField(group = "MCU")
	public AlarmInfo getMotorACSTGShortFault() {
		int level = (ByteUtils.getInt(data, 21, 22) & 0x38) >> 3;

		String str = "";
		switch (level) {
		case 0:
			str += "正常";
			break;
		case 3:
			str += "三级故障";
			break;
		case 4:
			str += "四级故障";
			break;
		default:
			str += "数据异常"; level = -1; break;
		}
		return new AlarmInfo("电机交流侧对地短路", str, level);
	}*/

    /**
     * 电机控制器硬件故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorControllerHardwareFailure() {
        int level = (ByteUtils.getInt(data, 21, 22) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3500901";
                break;
            case 3:
                str += "四级故障";
                code = "E0000EC3501004";
                level = 4;
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器硬件故障", str, level, code);
    }

    /**
     * 电机控制器过温故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlOverTempFault() {
        int level = (ByteUtils.getInt(data, 21, 22) & 0xC0) >> 6;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3501301";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3501402";
                break;
            case 3:
                str += "三级故障";
                code = "E0000EC3501503";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器过温故障", str, level, code);
    }

    /**
     * 电机控制器控制板低压异常
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlPanelUnderVolFault() {
        int level = ByteUtils.getInt(data, 22, 23) & 0x03;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器控制板低压异常", str, level, code);
    }

    /**
     * 电机控制器预充电异常
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlPerChargeVolFault() {
        int level = (ByteUtils.getInt(data, 22, 23) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器预充电异常", str, level, code);
    }

    /**
     * 电机控制器IGBT模块故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlIGBTFault() {
        int level = (ByteUtils.getInt(data, 22, 23) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器IGBT模块故障", str, level, code);
    }

    /**
     * 电机控制器IGBT过温故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlIGBTOverTempFault() {
        int level = (ByteUtils.getInt(data, 22, 23) & 0xC0) >> 6;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3501702";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器IGBT过温故障", str, level, code);
    }

    /**
     * 电机控制器IGBT过流故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlIGBTOverCurrFault() {
        int level = (ByteUtils.getInt(data, 23, 24) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3501902";
                break;
            case 3:
                str += "三级故障";
                code = "E0000EC3502003";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器IGBT过流故障", str, level, code);
    }

    /**
     * 电机控制器母线过压故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlGenerOverVolFault() {
        int level = (ByteUtils.getInt(data, 23, 24) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器母线过压故障", str, level, code);
    }

    /**
     * 电机控制器母线欠压故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlGenerUnderVolFault() {
        int level = (ByteUtils.getInt(data, 23, 24) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch ((ByteUtils.getInt(data, 23, 24) & 0x30) >> 4) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障";
                break;
            default:
                str += "保留";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器母线欠压故障", str, level, code);
    }

    /**
     * 电机控制器IGBT温度传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlIGBTTempSenSts() {
        int level = (ByteUtils.getInt(data, 23, 24) & 0xC0) >> 6;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3502302";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器IGBT温度传感器故障", str, level, code);
    }

    /**
     * 电机控制器CAN故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlCANFault() {
        int level = (ByteUtils.getInt(data, 24, 25) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器CAN故障", str, level, code);
    }

    /**
     * 电机温度传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorTempSenFault() {
        int level = (ByteUtils.getInt(data, 24, 25) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3502402";
                break;
            default:
                str += "保留";
                level = -1;
                break;
        }
        return new AlarmInfo("电机温度传感器故障", str, level, code);
    }

    /**
     * 电机控制器温度传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlTempSenFault() {
        int level = (ByteUtils.getInt(data, 24, 25) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 2:
                str += "二级故障";
                code = "E0000EC3502502";
                break;
            default:
                str += "保留";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器温度传感器故障", str, level, code);
    }

    /**
     * 电机控制器母线电压传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlGenerVolSenFault() {
        int level = (ByteUtils.getInt(data, 24, 25) & 0xC0) >> 6;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3502601";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器母线电压传感器故障", str, level, code);
    }

    /**
     * 电机控制器母线电流传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlGenerCurSenFault() {
        int level = (ByteUtils.getInt(data, 25, 26) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3502701";
                break;
            default:
                str += "保留";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器母线电流传感器故障", str, level, code);
    }

    /**
     * 电机控制器相电流传感器故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlACCurSenFault() {
        int level = (ByteUtils.getInt(data, 25, 26) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障";
                code = "E0000EC3502803";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机控制器相电流传感器故障", str, level, code);
    }

    /**
     * 电机旋变故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCtrlTranFault() {
        int level = (ByteUtils.getInt(data, 25, 26) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机旋变故障", str, level, code);
    }

    /**
     * 电机断路故障
     *
     * @return
     */
    @AlarmField(group = "MCU")
    public AlarmInfo getMotorCutOffFault() {
        int level = ByteUtils.getInt(data, 26, 27) & 0x07;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障";
                code = "E0000EC3503003";
                break;
            case 4:
                str += "四级故障";
                code = "E0000EC3503104";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电机断路故障", str, level, code);// ?
    }

    /******0x0CFF7D03********/

    /**
     * AC_CC信号
     *
     * @return
     */
    @CANField(group = "BMS", name = "AC_CC信号")
    public String getAC_CC() {
        return (ByteUtils.getInt(data, 28, 29) & 0x04) >> 2 == 0 ? "无效" : "有效";
    }

    /**
     * DC_CC信号
     *
     * @return
     */
    @CANField(group = "BMS", name = "DC_CC信号")
    public String getDC_CC() {
        return (ByteUtils.getInt(data, 28, 29) & 0x08) >> 3 == 0 ? "无效" : "有效";
    }

    /**
     * 电池组SOC
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池组SOC", suffix = "%")
    public String get_SOC() {
        return decimalFormatterss.format(ByteUtils.getUnsignedInt(data, 29, 30) * 0.5);
    }

    /**
     * 电池最高单体电压编号
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最高单体电压编号")
    public int getBatCellHVoltNum() {
        return ByteUtils.getInt(data, 30, 31);
    }

    /**
     * 电池最高单体电压
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最高单体电压", suffix = "V")
    public String getBatCellHVolt() {
        return decimalFormatter.format(ByteUtils.getUnsignedInt(data, 31, 33) * 0.001);
    }

    /**
     * 电池最低单体电压编号
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最低单体电压编号")
    public int getBatCellLVoltNum() {
        return ByteUtils.getInt(data, 33, 34);
    }

    /**
     * 电池最低单体电压
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最低单体电压", suffix = "V")
    public String getBatCellLVolt() {
        return decimalFormatter.format(ByteUtils.getUnsignedInt(data, 34, 36) * 0.001);
    }

    /********0x0CFF7E03*********/

    /**
     * 电池SOH
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池SOH")
    public int getBatSOH() {
        return ByteUtils.getInt(data, 37, 38);
    }

    /**
     * 电池组总电压
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池组总电压", suffix = "V")
    public int getBatPackVolt() {
        return (int) ByteUtils.getUnsignedInt(data, 38, 40);
    }

    /**
     * 电池组总电流
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池组总电流", suffix = "A")
    public int getBatPackCurr() {

        if (ByteUtils.getUnsignedInt(data, 40, 42) > 0) {

            return (int) (ByteUtils.getUnsignedInt(data, 40, 42) - 1000);
        } else {

            return 0;
        }

    }

    /**
     * 电池最高温度
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最高温度", suffix = "℃")
    public int getBatHTemp() {
        if (ByteUtils.getUnsignedInt(data, 42, 43) > 0) {

            return (int) (ByteUtils.getUnsignedInt(data, 42, 43) - 40);
        } else {

            return 0;
        }

    }

    /**
     * 电池最低温度
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池最低温度", suffix = "℃")
    public int getBatLTemp() {
        if (ByteUtils.getUnsignedInt(data, 43, 44) > 0) {

            return (int) (ByteUtils.getUnsignedInt(data, 43, 44) - 40);
        } else {

            return 0;
        }

    }

    /******0x0CFF7F03*******/

    /**
     * 充电状态
     *
     * @return
     */
    @CANField(group = "BMS", name = "充电状态")
    public String getBatChgState() {
        String str = "";
        switch ((ByteUtils.getInt(data, 44, 45) & 0x06) >> 1) {
            case 0:
                str += "未充电";
                break;
            case 1:
                str += "正在充电";
                break;
            case 2:
                str += "充电完成";
                break;
            default:
                str += "数据异常";
                break;
        }
        return str;
    }

    /**
     * 总正接触器状态
     *
     * @return
     */
    @CANField(group = "BMS", name = "总正接触器状态")
    public String getBMS_PosRlySts() {
        String str = "";
        switch ((ByteUtils.getInt(data, 44, 45) & 0x08) >> 3) {
            case 0:
                str += "断开";
                break;
            case 1:
                str += "闭合";
                break;
        }
        return str;
    }

    /**
     * 预充电接触器状态
     *
     * @return
     */
    @CANField(group = "BMS", name = "预充电接触器状态")
    public String getBMS_PrechgRlySts() {
        return (ByteUtils.getInt(data, 44, 45) & 0x10) >> 4 == 0 ? "断开" : "闭合";
    }

    /**
     * 总负接触器状态
     *
     * @return
     */
    @CANField(group = "BMS", name = "总负接触器状态")
    public String getBMS_NegRlySts() {
        return (ByteUtils.getInt(data, 44, 45) & 0x20) >> 5 == 0 ? "断开" : "闭合";
    }

    /**
     * 电池类型
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池类型")
    public String getBMS_BatType() {
        String str = "";
        switch ((ByteUtils.getInt(data, 45, 46) & 0x03)) {
            case 0:
                str += "磷酸铁锂";
                break;
            case 1:
                str += "锰酸锂";
                break;
            case 2:
                str += "三元锂";
                break;
            case 3:
                str += "混合三元锂";
                break;
        }
        return str;
    }

    /**
     * 绝缘阻值
     *
     * @return
     */
    @CANField(group = "BMS", name = "绝缘阻值", suffix = "kΩ")
    public long getBMS_PosIsoR() {
        return ByteUtils.getUnsignedInt(data, 50, 52) * 10;
    }

    /******0x0CFF8003********/

    /**
     * 电池容量
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池容量")
    public int getBMS_Capacity() {
        return (int) ByteUtils.getUnsignedInt(data, 53, 54);
    }

    /**
     * 电池充电次数
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池充电次数")
    public int getBMS_Chrge_times() {
        return (int) ByteUtils.getUnsignedInt(data, 54, 56);
    }

    /**
     * 过放电次数
     *
     * @return
     */
    /*@CANField(group = "BMS", name = "过放电次数")
	public int getBMS_Discharge_times() {
		return (int) ByteUtils.getUnsignedInt(data, 56, 58);
	}
*/

    /**
     * 电池能量
     *
     * @return
     */
    @CANField(group = "BMS", name = "电池能量")
    public String getBMS_Energy() {
        return decimalFormatters.format(ByteUtils.getUnsignedInt(data, 58, 60) * 0.01);
    }

    /********0x0CFF8103********/

    /**
     * 预充电故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_PrechgFlt() {
        int level = (ByteUtils.getInt(data, 60, 61) & 0x08) >> 3;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("预充电故障", str, level, code);
    }

    /**
     * 总正接触器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_PosRlyFlt() {
        int level = (ByteUtils.getInt(data, 60, 61) & 0x10) >> 4;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("总正接触器故障", str, level, code);
    }

    /**
     * 总负接触器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_NegRlyFlt() {
        int level = (ByteUtils.getInt(data, 60, 61) & 0x20) >> 5;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("总负接触器故障", str, level, code);
    }

    /**
     * 预充接触器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_PrechgRlyFlt() {
        int level = (ByteUtils.getInt(data, 60, 61) & 0x40) >> 6;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("预充接触器故障", str, level, code);
    }

    /**
     * 充电机接触器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_ChgrRlyFlt() {
        int level = (ByteUtils.getInt(data, 60, 61) & 0x80) >> 7;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("充电机接触器故障", str, level, code);
    }

    /**
     * 温度过低故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_LTempFlt() {
        int level = ByteUtils.getInt(data, 61, 62) & 0x03;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3510801";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3510902";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("温度过低故障", str, level, code);
    }

    /**
     * 温度过高故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_HTempFlt() {
        int level = (ByteUtils.getInt(data, 61, 62) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3511101";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3511202";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("温度过高故障", str, level, code);
    }

    /**
     * 温度差异故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_DeltaTempFlt() {
        int level = (ByteUtils.getInt(data, 61, 62) & 0x30) >> 4;

        String str = "";
        String code = "";
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3511402";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("温度差异故障", str, level, code);
    }

    /**
     * 湿度过大故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_HMoisFlt() {
        int level = (ByteUtils.getInt(data, 61, 62) & 0xC0) >> 6;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障，灯亮";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("湿度过大故障", str, level, code);
    }

    /**
     * 充电过流故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_OvrChgFlt() {
        int level = (ByteUtils.getInt(data, 62, 63) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3511601";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3511702";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("充电过流故障", str, level, code);
    }

    /**
     * 放电过流故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_OvrDischgFlt() {
        int level = (ByteUtils.getInt(data, 62, 63) & 0x0C) >> 2;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3511901";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3512002";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("放电过流故障", str, level, code);
    }

    /**
     * 单体电压差异故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_CellDeltaVoltFlt() {
        int level = (ByteUtils.getInt(data, 63, 64) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                code = "E0000EC3512401";
                break;
            case 2:
                str += "二级故障，灯亮";
                code = "E0000EC3512502";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("单体电压差异故障", str, level, code);
    }

    /**
     * 电池组欠压故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_PackLVoltFlt() {
        int level = (ByteUtils.getInt(data, 63, 64) & 0x30) >> 4;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 1:
                str += "一级故障";
                break;
            case 2:
                str += "二级故障，灯亮";
                break;
            case 3:
                str += "三级故障";
                break;
            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("电池组欠压故障", str, level, code);
    }

    /**
     * SOC过低故障
     *
     * @return
     */
	/*@AlarmField(group = "BMS")
	public AlarmInfo getBMS_LSOCFlt() {
		int level = (ByteUtils.getInt(data, 63, 64) & 0xC0) >> 6;

		String str = "";
		switch (level) {
		case 0:
			str += "正常";
			break;
		case 1:
			str += "一级故障";
			break;
		case 2:
			str += "二级故障，灯亮";
			break;
		case 3:
			str += "三级故障";
			break;
		default:
			str += "数据异常"; level =-1; break;
		}
		return new AlarmInfo("SOC过低故障", str, level);
	}
*/
    /**
     * SOC过高故障
     *
     * @return
     */
	/*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_HSOCFlt() {
		int level = (ByteUtils.getInt(data, 64, 65) & 0x03);

		String str = "";
		switch (level) {
		case 0:
			str += "正常";
			break;
		case 1:
			str += "一级故障";
			break;
		case 2:
			str += "二级故障，灯亮";
			break;
		case 3:
			str += "三级故障";
			break;
		default:
			str += "数据异常"; level =-1; break;
		}
		return new AlarmInfo("SOC过高故障", str, level);
	}*/

    /**
     * 控制板电源故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_BattFlt() {
		int level = (ByteUtils.getInt(data, 64, 65) & 0x04) >> 2;

		String str = "";
		switch (level) {
		case 0:
			str += "正常";
			break;
		case 1:
			str += "一级故障";
			break;
		default:
			str += "数据异常"; level =-1; break;
		}
		return new AlarmInfo("控制板电源故障", str, level);
	}*/

    /**
     * 子板CAN通讯故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_SlaveCANFlt() {
        int level = (ByteUtils.getInt(data, 64, 65) & 0x18) >> 3;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障，灯亮";
                break;
            default:
                str += "其他值保留";
                level = -1;
                break;
        }
        return new AlarmInfo("子板CAN通讯故障", str, level, code);
    }

    /**
     * 与VCU间CAN通讯故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_VCUCANFlt() {
        int level = (ByteUtils.getInt(data, 64, 65) & 0x60) >> 5;

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障，灯亮";
                break;
            default:
                str += "其他值保留";
                level = -1;
                break;
        }
        return new AlarmInfo("与VCU间CAN通讯故障", str, level, code);
    }

    /**
     * 与充电机CAN通讯故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_ChgrCANFlt() {
        int level = (ByteUtils.getInt(data, 65, 66) & 0x03);

        String str = "";
        String code = null;
        switch (level) {
            case 0:
                str += "正常";
                break;
            case 3:
                str += "三级故障，灯亮";
                break;
            default:
                str += "其他值保留";
                level = -1;
                break;
        }
        return new AlarmInfo("与充电机CAN通讯故障", str, level, code);
    }

    /**
     * 电池冷却系统故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_CoolSysFlt() {
		int level = (ByteUtils.getInt(data, 65, 66) & 0x04) >> 2;

		String str = "";
		if (level == 0) {

			str += "正常";
		} else {

			str += "一级故障";
			level = 1;
		}
		return new AlarmInfo("电池冷却系统故障", str, level);
	}

	*//**
     * 电池加热系统故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_HeatSysFlt() {
		int level = (ByteUtils.getInt(data, 65, 66) & 0x08) >> 3;

		String str = "";
		if (level == 0) {

			str += "正常";
		} else {

			str += "一级故障";
			level = 1;
		}
		return  new AlarmInfo("电池加热系统故障", str, level);
	}

	*//**
     * 单体电压传感器故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_CellVoltSensorFlt() {
		int level = (ByteUtils.getInt(data, 65, 66) & 0x10) >> 4;

		String str = "";
		if (level == 0) {

			str += "正常";
		} else {

			str += "一级故障";
			level = 1;
		}
		return  new AlarmInfo("单体电压传感器故障", str, level);
	}*/

    /**
     * 电流传感器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_CurrSensorFlt() {
        int level = (ByteUtils.getInt(data, 65, 66) & 0x20) >> 5;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "二级故障";
            code = "E0000EC3513402";
            level = 2;
        }
        return new AlarmInfo("电流传感器故障", str, level, code);
    }

    /**
     * 温度传感器故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_TempSensorFlt() {
        int level = (ByteUtils.getInt(data, 65, 66) & 0x40) >> 6;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
            code = "E0000EC3513501";
            level = 1;
        }
        return new AlarmInfo("温度传感器故障", str, level, code);
    }

    /**
     * 总电压传感器故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_PackVoltSensorFlt() {
		int level = (ByteUtils.getInt(data, 65, 66) & 0x80) >> 7;

		String str = "";
		if (level == 0) {

			str += "正常";
		} else {

			str += "一级故障";
			level = 1;
		}
		return new AlarmInfo("总电压传感器故障", str, level) ;
	}
*/
    /**
     * 湿度传感器故障
     *
     * @return
     *//*
	@AlarmField(group = "BMS")
	public AlarmInfo getBMS_MoisSensorFlt() {
		int level = (ByteUtils.getInt(data, 66, 67) & 0x01);

		String str = "";
		if (level == 0) {

			str += "正常";
		} else {

			str += "一级故障";
			level = 1;
		}
		return new AlarmInfo("湿度传感器故障", str, level);
	}*/

    /**
     * 充电机故障
     *
     * @return
     */
    @AlarmField(group = "BMS")
    public AlarmInfo getBMS_ChgrSensorFlt() {
        int level = (ByteUtils.getInt(data, 66, 67) & 0x02) >> 1;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "一级故障";
        }
        return new AlarmInfo("充电机故障", str, level, code);
    }

    /**
     * 维修开关接通状态
     *
     * @return
     *//*
	@CANField(group = "BMS", name = "维修开关接通状态")
	public String getDC_Switch() {
		return (ByteUtils.getInt(data, 66, 67) & 0x04) >> 2 == 0 ? "断开" : "接通";
	}

	*//**
     * 电池包揭盖开关
     *
     * @return
     *//*
	@CANField(group = "BMS", name = "电池包揭盖开关")
	public String getPack_Switch() {
		return (ByteUtils.getInt(data, 66, 67) & 0x08) >> 3 == 0 ? "关闭" : "打开";
	}*/

    /******0x0CFF8203********/
    /******0x0CFF8303********/

    /******0x18FFDC01********/

    /**
     * EPS故障
     *
     * @return
     */
    @AlarmField(group = "VCU")
    public AlarmInfo getEPS_error() {
        int level = (ByteUtils.getInt(data, 84, 85) & 0x02) >> 1;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "故障";
        }
        return new AlarmInfo("EPS故障", str, level, code);
    }

    /**
     * 整车故障状态
     *
     * @return
     *//*
	@AlarmField(group = "VCU")
	public AlarmInfo getVehicle_Fault_Status() {
		int level = (ByteUtils.getInt(data, 84, 85) & 0x1C) >> 2;

		String str = "";

		switch (level) {

		case 0 : str += "正常"; break;
		case 1 : str += "一级故障"; break;
		case 2 : str += "二级故障，灯亮"; break;
		case 3 : str += "四级故障，灯亮"; level = 4; break;

		default : str += ""; break;
		}
		return  new AlarmInfo("整车故障状态", str, level);
	}*/

    /**
     * 维修保养提示
     *
     * @return
     */
    @CANField(group = "VCU", name = "维修保养提示")
    public String getMaintance_Indictor_Status() {
        return (ByteUtils.getInt(data, 84, 85) & 0x20) >> 5 == 0 ? "正常" : "提示需维修";
    }

    /**
     * 充电锁止
     *
     * @return
     */
    @CANField(group = "VCU", name = "充电锁止")
    public String getCharge_shocked() {
        return (ByteUtils.getInt(data, 84, 85) & 0x40) >> 6 == 0 ? "正常" : "锁止";
    }

    /**
     * 故障码
     *
     * @return
     */
    @AlarmField(group = "VCU")
    public AlarmInfo getError_code() {
        int level = ByteUtils.getInt(data, 85, 87);

        String str = "";
        String code = null;

        switch (level) {

            case 420:
                str += "电机超速故障";
                level = 4;
                code = "E0000EC3500104";
                break;
            case 421:
                str += "电机堵转故障";
                level = 1;
                code = "E0000EC3500201";
                break;
            case 422:
                str += "电机超温故障";
                level = 1;
                code = "E0000EC3500301";
                break;
            case 423:
                str += "电机超温故障";
                level = 2;
                code = "E0000EC3500402";
                break;
            case 424:
                str += "电机超温故障";
                level = 3;
                code = "E0000EC3500503";
                break;
            case 425:
                str += "电机超温故障";
                level = 4;
                code = "E0000EC3500604";
                break;
            case 426:
                str += "电机过流故障";
                level = 2;
                code = "E0000EC3500804";
                break;
            case 427:
                str += "电机过流故障";
                level = 4;
                code = "E0000EC3500804";
                break;
            case 428:
                str += "电机控制器硬件故障";
                level = 1;
                code = "E0000EC3500901";
                break;
            case 429:
                str += "电机控制器硬件故障";
                level = 4;
                code = "E0000EC3501004";
                break;
            case 430:
                str += "电机交流侧对地短路";
                level = 3;
                code = "E0000EC3501103";
                break;
            case 431:
                str += "电机交流侧对地短路";
                level = 4;
                code = "E0000EC3501204";
                break;
            case 432:
                str += "电机控制器过温故障";
                level = 1;
                code = "E0000EC3501301";
                break;
            case 433:
                str += "电机控制器过温故障";
                level = 2;
                code = "E0000EC3501402";
                break;
            case 434:
                str += "电机控制器过温故障";
                level = 3;
                code = "E0000EC3501503";
                break;
            case 435:
                str += "电机控制器IGBT模块故障";
                level = 4;
                code = "E0000EC3501604";
                break;
            case 436:
                str += "电机控制器IGBT过温故障";
                level = 2;
                code = "E0000EC3501702";
                break;
            case 437:
                str += "电机控制器IGBT过温故障";
                level = 4;
                code = "E0000EC3501804";
                break;
            case 438:
                str += "电机控制器IGBT过流故障";
                level = 2;
                code = "E0000EC3501902";
                break;
            case 439:
                str += "电机控制器IGBT过流故障";
                level = 3;
                code = "E0000EC3502003";
                break;
            case 440:
                str += "电机控制器母线过压故障";
                level = 4;
                code = "E0000EC3502104";
                break;
            case 441:
                str += "电机控制器母线欠压故障";
                level = 4;
                code = "E0000EC3502204";
                break;
            case 442:
                str += "电机控制器IGBT温度传感器故障";
                level = 2;
                code = "E0000EC3502302";
                break;
            case 443:
                str += "电机温度传感器故障";
                level = 2;
                code = "E0000EC3502402";
                break;
            case 444:
                str += "电机控制器温度传感器故障";
                level = 2;
                code = "E0000EC3502502";
                break;
            case 445:
                str += "电机控制器母线电压传感器故障";
                level = 1;
                code = "E0000EC3502601";
                break;
            case 446:
                str += "电机控制器母线电流传感器故障";
                level = 1;
                code = "E0000EC3502701";
                break;
            case 447:
                str += "电机控制器相电流传感器故障";
                level = 3;
                code = "E0000EC3502803";
                break;
            case 448:
                str += "电机旋变故障";
                level = 4;
                code = "E0000EC3502904";
                break;
            case 449:
                str += "电机断路故障";
                level = 3;
                code = "E0000EC3503003";
                break;
            case 450:
                str += "电机断路故障";
                level = 4;
                code = "E0000EC3503104";
                break;
            case 451:
                str += "电机控制器CAN故障";
                level = 4;
                code = "";
                break;

            case 520:
                str += "绝缘故障";
                level = 1;
                code = "E0000EC3510101";
                break;
            case 521:
                str += "绝缘故障";
                level = 4;
                code = "E0000EC3510204";
                break;
            case 522:
                str += "预充电故障";
                level = 4;
                code = "E0000EC3510304";
                break;
            case 523:
                str += "总正接触器故障";
                level = 4;
                code = "E0000EC3510404";
                break;
            case 524:
                str += "总负接触器故障";
                level = 4;
                code = "E0000EC3510504";
                break;
            case 525:
                str += "预充接触器故障";
                level = 4;
                code = "E0000EC3510604";
                break;
            case 526:
                str += "充电机接触器故障";
                level = 4;
                code = "E0000EC3510704";
                break;
            case 527:
                str += "温度过低故障";
                level = 1;
                code = "E0000EC3510801";
                break;
            case 528:
                str += "温度过低故障";
                level = 2;
                code = "E0000EC3510902";
                break;
            case 529:
                str += "温度过低故障";
                level = 4;
                code = "E0000EC3511004";
                break;
            case 530:
                str += "温度过高故障";
                level = 1;
                code = "E0000EC3511101";
                break;
            case 531:
                str += "温度过高故障";
                level = 2;
                code = "E0000EC3511202";
                break;
            case 532:
                str += "温度过高故障";
                level = 4;
                code = "E0000EC3511304";
                break;
            case 533:
                str += "温度差异故障";
                level = 2;
                code = "E0000EC3511402";
                break;
            case 534:
                str += "温度差异故障";
                level = 4;
                code = "E0000EC3511504";
                break;
            case 535:
                str += "充电过流故障";
                level = 1;
                code = "E0000EC3511601";
                break;
            case 536:
                str += "充电过流故障";
                level = 2;
                code = "E0000EC3511702";
                break;
            case 537:
                str += "充电过流故障";
                level = 4;
                code = "E0000EC3511804";
                break;
            case 538:
                str += "放电过流故障";
                level = 1;
                code = "E0000EC3511901";
                break;
            case 539:
                str += "放电过流故障";
                level = 2;
                code = "E0000EC3512002";
                break;
            case 540:
                str += "放电过流故障";
                level = 4;
                code = "E0000EC3512104";
                break;
            case 541:
                str += "单体过压故障";
                level = 4;
                code = "E0000EC3512204";
                break;
            case 542:
                str += "单体欠压故障";
                level = 4;
                code = "E0000EC3512304";
                break;
            case 543:
                str += "单体电压差异故障";
                level = 1;
                code = "E0000EC3512401";
                break;
            case 544:
                str += "单体电压差异故障";
                level = 2;
                code = "E0000EC3512502";
                break;
            case 545:
                str += "电池组过压故障";
                level = 4;
                code = "E0000EC3512604";
                break;
            case 546:
                str += "电池组欠压故障";
                level = 4;
                code = "E0000EC3512704";
                break;
            case 548:
                str += "子板CAN通讯故障";
                level = 4;
                code = "E0000EC3512904";
                break;
            case 549:
                str += "与充电机CAN通讯故障";
                level = 4;
                code = "E0000EC3513004";
                break;
            case 550:
                str += "电池冷却系统故障";
                level = 1;
                code = "E0000EC3513101";
                break;
            case 551:
                str += "电池加热系统故障";
                level = 1;
                code = "E0000EC3513201";
                break;
            case 552:
                str += "单体电压传感器故障";
                level = 1;
                code = "E0000EC3513301";
                break;
            case 553:
                str += "电流传感器故障";
                level = 2;
                code = "E0000EC3513402";
                break;
            case 554:
                str += "温度传感器故障";
                level = 1;
                code = "E0000EC3513501";
                break;
            case 555:
                str += "总电压传感器故障";
                level = 1;
                code = "E0000EC3513601";
                break;
            case 556:
                str += "湿度传感器故障";
                level = 1;
                code = "E0000EC3513701";
                break;
            case 557:
                str += "维修开关接通状态";
                level = 1;
                code = "E0000EC3513801";
                break;
            case 558:
                str += "电池包揭盖开关";
                level = 1;
                code = "E0000EC3513901";
                break;
            case 559:
                str += "与VCU通讯故障";
                level = 1;
                code = "E0000EC3514001";
                break;

            case 620:
                str += "充电机故障";
                level = 4;
                code = "E0000EC3520104";
                break;
            case 621:
                str += "OBC温度故障";
                level = 4;
                break;
            case 622:
                str += "OBC输入电压故障";
                level = 4;
                break;
            case 623:
                str += "OBC启动状态";
                level = 4;
                break;
            case 624:
                str += "OBC通信状态";
                level = 4;
                break;

            case 720:
                str += "加速踏板信号1超出上限";
                level = 4;
                code = "E0000EC3530104";
                break;
            case 721:
                str += "加速踏板信号1超出下限";
                level = 4;
                code = "E0000EC3530204";
                break;
            case 722:
                str += "加速踏板信号2超出上限";
                level = 3;
                code = "E0000EC3530303";
                break;
            case 723:
                str += "加速踏板信号2超出下限";
                level = 3;
                code = "E0000EC3530403";
                break;
            case 724:
                str += "加速踏板信号校验故障";
                level = 3;
                code = "E0000EC3530503";
                break;
            case 725:
                str += "真空压力传感器信号对电源短路";
                level = 4;
                code = "E0000EC3530604";
                break;
            case 726:
                str += "真空压力传感器信号超出下限";
                level = 4;
                code = "E0000EC3530704";
                break;
            case 727:
                str += "真空泵故障（加逻辑）";
                level = 4;
                break;
            case 728:
                str += "EPB故障";
                level = 1;
                code = "E0000EC3530901";
                break;
            case 729:
                str += "EPS故障";
                level = 4;
                code = "E0000EC3531004";
                break;
            case 730:
                str += "高压意外断开";
                level = 4;
                code = "E0000EC3531104";
                break;
            case 731:
                str += "电机控制器供电失效";
                level = 4;
                code = "E0000EC3531204";
                break;
            case 732:
                str += "BMS使能驱动模块故障";
                level = 4;
                code = "E0000EC3531304";
                break;
            case 733:
                str += "真空泵驱动模块故障";
                level = 4;
                code = "E0000EC3531404";
                break;
            case 734:
                str += "辅助电池电压偏低";
                level = 1;
                code = "E0000EC3531501";
                break;
            case 735:
                str += "水泵无水";
                level = 1;
                code = "E0000EC3531601";
                break;
            case 736:
                str += "水泵本体故障";
                level = 1;
                code = "E0000EC3531701";
                break;

            default:
                str += "数据异常";
                level = -1;
                break;
        }
        return new AlarmInfo("故障码", str, level, code);
    }

    /**
     * 加速踏板开度
     *
     * @return
     */
    @CANField(group = "VCU", name = "加速踏板开度")
    public int getAccpedal() {
        return ByteUtils.getInt(data, 87, 88);
    }

    /**
     * 制动踏板开关
     *
     * @return
     */
    @CANField(group = "VCU", name = "制动踏板开关")
    public String getBrakeSW() {
        return (ByteUtils.getInt(data, 88, 89) & 0x01) == 0 ? "否" : "是";
    }

    /**
     * 跛行信号
     *
     * @return
     */
    @CANField(group = "VCU", name = "跛行信号")
    public String getLamphome() {
        return (ByteUtils.getInt(data, 88, 89) & 0x02) >> 1 == 0 ? "否" : "是";
    }

    /**
     * 辅助电池故障
     *
     * @return
     */
    @AlarmField(group = "VCU")
    public AlarmInfo getBat12VErr() {
        int level = (ByteUtils.getInt(data, 88, 89) & 0x10) >> 4;

        String str = "";
        String code = null;
        if (level == 0) {

            str += "正常";
        } else {

            str += "辅助电池亏电";
        }
        return new AlarmInfo("辅助电池故障", str, level, code);
    }

    /****0x18FEDCD5******/

    /**
     * 车速
     *
     * @return
     */
    @CANField(group = "VCU", name = "车速", suffix = "KM/H")
    public int getCarSpeed() {
        return ByteUtils.getInt(data, 92, 93);
    }

    /**
     * 总里程
     *
     * @return
     */
    @CANField(group = "VCU", name = "总里程", suffix = "KM")
    public long getDistance() {
        return ByteUtils.getUnsignedInt(data, 93, 97);
    }

    /*******0x18FFDD06*******/

    /**
     * EPB状态
     *
     * @return
     */
    @CANField(group = "Meter_VCU_1", name = "EPB状态")
    public String getEPBState() {
        return ((ByteUtils.getUnsignedInt(data, 100, 97) & 0x10) >> 4) == 0 ? "手刹放下" : "手刹拉起";
    }

    /**
     * EPB故障
     *
     * @return
     */
    @AlarmField(group = "Meter_VCU_1")
    public AlarmInfo getEPB_Flt() {
        int level = (ByteUtils.getUnsignedShort(data, 100, 97) & 0x20) >> 5;
        String str = "";

        String code = null;

        switch (level) {

            case 0:
                str += "正常";
                break;
            case 1:
                str += "故障";
                code = "E0000EC3530901";
                break;

            default:
                str += "";
                break;
        }
        return new AlarmInfo("EPB故障", str, level, code);
    }

    public double getSpeed() {
        return getCarSpeed();
    }

    public double getSOC() {
        return Double.parseDouble(get_SOC());
    }

    public double getTotalMileage() {
        return getDistance();
    }

    public double getVoltage() {
        return getBatPackVolt();
    }

    public double getElectric() {
        return getBatPackCurr();
    }

    @Override
    public int getACCState() {
        return -1;
    }

    @Override
    public byte[] getHighVoltageBatteryCurrent() {
        return new byte[]{};
    }

    @Override
    public byte[] getSoc() {
        return ByteUtils.shortToByte((short) (ByteUtils.getUnsignedShort(data, 29, 30) == 0 ? 0 : ByteUtils.getUnsignedShort(data, 29, 30) * 0.5));
    }

    @Override
    public byte[] getRemainEnergy() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryVoltageAlways() {
        return ByteUtils.getRangeConvert(data, 38, 40);
    }

    @Override
    public byte[] getBatteryPackMaxTemperatureInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMaxTemperatureData() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMinTemperatureInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMinTemperatureData() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMaxVoltageInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMaxVoltageData() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMinVoltageInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryPackMinVoltageData() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigBatteryPackMaxTemperatureInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMaxTemperatureNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMaxTemperature() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigBatteryPackMinTemperatureInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMinTemperatureNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMinTemperature() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigBatteryPackMaxVoltageInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMaxVoltageNumber() {
        return ByteUtils.getBytes(ByteUtils.getUnsignedShort(data, 30, 31) == 0 ? 0 : ByteUtils.getUnsignedShort(data, 30, 31), new byte[1]);
    }

    @Override
    public byte[] getSigMaxVoltage() {
        return ByteUtils.shortToByte((short) (ByteUtils.getUnsignedShort(data, 31, 33) == 0 ? 0 : ByteUtils.getUnsignedInt(data, 31, 33) * 0.001));
    }

    @Override
    public byte[] getSigBatteryPackMinVoltageInPackageSerialNumber() {
        return new byte[]{};
    }

    @Override
    public byte[] getSigMinVoltageNumber() {
        return ByteUtils.getBytes(ByteUtils.getUnsignedShort(data, 33, 34) == 0 ? 0 : ByteUtils.getUnsignedShort(data, 33, 34), new byte[1]);
    }

    @Override
    public byte[] getSigMinVoltage() {
        return ByteUtils.shortToByte((short) (ByteUtils.getUnsignedShort(data, 34, 36) == 0 ? 0 : ByteUtils.getUnsignedInt(data, 34, 36) * 0.001));
    }

    @Override
    public byte[] getInsulationResistanceValue() {
        return new byte[]{};
    }

    @Override
    public byte[] getBatteryEqualizationActivation() {
        return new byte[]{};
    }

    @Override
    public byte[] getLiquidFuelConsumption() {
        return new byte[]{};
    }

    @Override
    public byte[] getMaxDischargeBatteryPack() {
        return new byte[]{};
    }

    @Override
    public byte[] getMaxChargingeBatteryPack() {
        return new byte[]{};
    }

    @Override
    public byte[] getAcceleratorPedalStroke() {
        return new byte[]{};
    }

    @Override
    public byte[] getBrakePedalStroke() {
        return new byte[]{};
    }

    @Override
    public byte[] getPowerSystemPlace() {
        return new byte[]{};
    }

    @Override
    public byte[] getEmergencyPowerRequest() {
        return new byte[]{};
    }

    @Override
    public byte[] getCurrentVehicleState() {
        return new byte[]{};
    }

    @Override
    public byte[] getMotorControllerTemperature() {
        return ByteUtils.getBytes(ByteUtils.getUnsignedShort(data, 17, 18) == 0 ? 0 : ByteUtils.getUnsignedShort(data, 17, 18) - 40, new byte[1]);
    }

    @Override
    public byte[] getMotorSpeed() {
        return ByteUtils.shortToByte((short) (ByteUtils.getUnsignedShort(data, 8, 10) - 12000));
    }

    @Override
    public byte[] getMotorTemperature() {
        return ByteUtils.getBytes(ByteUtils.getUnsignedShort(data, 16, 17) == 0 ? 0 : ByteUtils.getUnsignedShort(data, 16, 17) - 40, new byte[1]);
    }

    @Override
    public byte[] getMotorBusbarCurrent() {
        return new byte[]{};
    }

    @Override
    public byte[] getMotorControllerBeforeVoltage() {
        return new byte[]{};
    }

    @Override
    public byte[] getMotorControllerAfterVoltage() {
        return new byte[]{};
    }

    @Override
    public byte[] getMotorController() {
        return new byte[]{};
    }

    @Override
    public byte[] getMotorTorque() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public byte[] getAccumulateMileage() {
        return ByteUtils.getRangeConvert(data, 93, 97);
    }

    @Override
    public byte[] getRange() {
        return new byte[]{};
    }

    @Override
    public byte[] getIgnitionTime() {
        return new byte[]{00, 00, 00, 00, 00, 00};
    }

    @Override
    public byte[] getOffTime() {
        return new byte[]{00, 00, 00, 00, 00, 00};
    }

    @Override
    public double getPowerMileage() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public byte[] getBatteryVolElectric() {
        // TODO Auto-generated method stub
        return null;
    }
}